package com.will.yuaiagent.common;

import com.will.yuaiagent.exception.ErrorCode;

/**
 * @author will
 * @since 2025/6/26 09:36
 */
public class ResultUtils {
    public static <T> BaseReponse<T> success(T data){
        return new BaseReponse<>(0, data, "ok");
    }
    public static <T> BaseReponse<T> error(ErrorCode errorCode){
        return new BaseReponse<>(errorCode);
    }
    public static <T> BaseReponse<T> error(int code, String message){
        return new BaseReponse<>(code,null, message);
    }
    public static <T> BaseReponse<T> error(ErrorCode errorCode, String message){
        return new BaseReponse<>(errorCode.getCode(),null, message);
    }
}
